<template>
	<scroll-view class="scroll" scroll-y>
		<view class="u-m-b-20" v-for="(pItem,pIndex) in opts" :key="pIndex">
			<u-cell-group>
				<u-cell-item :titleStyle="{fontWeight: 500}" @click="handleClick(cItem.type,cItem.path)"
					:title="cItem.name" :value="cItem.value" v-for="(cItem, cIndex) in pItem.children" :key="cIndex">
					<!-- <image slot="icon" class="u-cell-icon" :src="getIcon(item.icon)" mode="widthFix"></image> -->
				</u-cell-item>
			</u-cell-group>
		</view>
	</scroll-view>
</template>

<script>
	export default {
		name: 'SOptCellU',
		props: {
			opts: {
				type: Array,
				default () {
					return []
				}
			}
		},
		data() {
			return {}
		},
		computed: {
			getIcon() {
				return path => {
					return 'https://cdn.uviewui.com/uview/example/' + path + '.png';
				}
			}
		},
		methods: {
			handleClick(type, path) {
				uni.navigateTo({
					url: path
				})
			}
		}
	}
</script>

<style lang="less" scoped>
	.scroll {
		flex-direction: column;
		flex: 1;
	}
</style>
